<!--
 * @author: sanbao
 * @Date: 2022-08-23 18:15:00
-->
<style lang='scss' scoped>
.my_one {
  box-sizing: border-box;
  padding: 16px;
  width: 100%;
  height: 100%;
  .bg {
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.05);
  }
  #echarts {
    height: 200px;
  }
}
</style>
<template>
  <div class="my_one">
    <div class="bg">
      <div class="title">
        <i class="iconsize iconfont icon-tongji4"></i>
        <span class="">任务通过率</span>
      </div>
      <div id="echarts"></div>
    </div>
  </div>
</template>

<script lang='ts'>
import {
  defineComponent,
  ref,
  reactive,
  toRefs,
  computed,
  onMounted,
} from "vue";
import * as echarts from "echarts";
export default defineComponent({
  components: {},
  setup() {
    onMounted(() => {
      getdocument();
    });
    const getdocument = () => {
      let myChart = echarts.init(document.getElementById("echarts"));
      myChart.setOption({
        tooltip: {
          trigger: "item",
        },
        legend: {
          top: "5%",
          left: "center",
        },
        series: [
          {
            name: "Access From",
            type: "pie",
            radius: ["40%", "70%"],
            avoidLabelOverlap: false,
            itemStyle: {
              borderRadius: 10,
              borderColor: "#fff",
              borderWidth: 2,
            },
            label: {
              show: false,
              position: "center",
            },
            emphasis: {
              label: {
                show: true,
                fontSize: "40",
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: [
              { value: 1048, name: "Search Engine" },
              { value: 735, name: "Direct" },
              { value: 580, name: "Email" },
              { value: 484, name: "Union Ads" },
              { value: 300, name: "Video Ads" },
            ],
          },
        ],
      });
      window.onresize = function () {
        myChart.resize();
      };
    };
    return {};
  },
});
</script>